//var e=getEvent();
//var jq = jQuery.noConflict();
//window.onbeforeunload=function(){ws.send("Logout");}

function getId(id)
{
    return document.getElementById(id);
}
function Datetime(tag)
{
    return new Date().toTimeString().split(' ')[tag];
}
function SetChatValue(Variables, value)
{
    ChatValue[Variables] = value;
}
function GetChatValue(Variables)
{
    return ChatValue[Variables];
}

var ChatValue = new Array(10);
function SwfloadCompleted(tag)
{
    if (tag == 'Video_main')
    {
        VideoLoaded = true;
        if (RoomInfo.type == '0')
        {
            getId('RoomMV').style.display = 'none';

        }
        else
        {
            if (RoomInfo.AutoPublicVideo == '1') {
                if (RoomInfo.PVideo == My.chatid)
                    thisMovie('pVideo').sConnect(RoomInfo.VServer, My.rid + '·' + My.chatid, '1');
                else
                    thisMovie('pVideo').pConnect(RoomInfo.VServer, My.rid + '·' + RoomInfo.PVideo, RoomInfo.PVideoNick);
            }
            if (RoomInfo.AutoSelfVideo == '1') {
                if (RoomInfo.PVideo == My.chatid)
                    thisMovie('pVideo').sConnect(RoomInfo.VServer, My.rid + '·' + My.chatid, '1');
                else
                    thisMovie('pVideo').sConnect(RoomInfo.VServer, My.rid + '·' + My.chatid, '2');
            }
        }
    }
}
function showLive() {
    if (RoomInfo.OtherVideoAutoPlayer == '0') {
        location.reload();
    }
    $('#OnLine_MV').html($('#OnLine_MV').html());
}
var socket;
var page_fire;
function OnSocket() {    
	socket = io("ws://" + RoomInfo.TServer + ":" + RoomInfo.TSPort);
    socket.on('connect', function() {
        onConnect();
    });
    socket.on('message', function(data) {
		//console.log(data);
        WriteMessage(data);
    });
}
function OnInit()
{
    if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style)
    {
        location.href = 'error.php?msg=' + encodeURIComponent('您使用的是不安全IE6.0浏览器,请升级到最新版本或<br>下载安装<a href=http://chrome.360.cn/ target=_blank>360浏览器</a>或<a href=http://www.baidu.com/s?wd=chrome target=_blank>Google浏览器</a>!');
        return false;
    }
    $.ajaxSetup({contentType: "application/x-www-form-urlencoded; charset=utf-8"});

    $("body").click(function() {
        MsgCAlert();
    });
    //auth
    if (check_auth("room_admin")){
        $('#manage_div').show();
        $('#OnlineUser_Find').show();
    }

    //发送自定义聊天图片
    if (check_auth("custom_pic")){
        $('.chat_img').show();
        $('#OnlineUser_Find').show();
    }

    if (check_auth("rebots_msg"))
        $('#chat_type').show();
    if (check_auth("def_videosrc"))
        $('#bt_defvideosrc').show();

    if (check_auth("online_sum"))
        $('#onlineWrap').show();

    OnSocket();
    
    //5分钟提示登录
    if (RoomInfo.loginTip == '1' && My.chatid.indexOf('x') > -1)
        setInterval("loginTip()", 1000 * 60 * 5);

    $('#Msg').html("连接中...");


    window.moveTo(0, 0);
    window.resizeTo(screen.availWidth, screen.availHeight);
    OnResize();

    if (RoomInfo.OtherVideoAutoPlayer != "0") {

        $('#OnLine_MV').html('<iframe height="100%" width="100%" allowTransparency="true" marginwidth="0" marginheight="0"  frameborder="0" scrolling="no" src="player.php?type=pc&rid='+globalgid+'"></iframe>');
    } else {
        var vFlash = new SWFObject("images/Video_main.swf?Q=" + RoomInfo.VideoQ, "pVideo", "520", "390", "9", "#FFF");
        vFlash.addParam("wmode", "transparent");
        vFlash.addParam("allowFullScreen", "true");
        vFlash.addParam("allowScriptAccess", "always");
        vFlash.write("OnLine_MV");
    }

    interfaceInit();
    POPChat.Init();
    ToUser.set('ALL', '大家');
    dragMsgWinx(getId('drag_bar'));
    $('#MsgBox1').niceScroll({cursorcolor: "#FFF", cursorwidth: "2px", cursorborder: "0px;"});
    $('#MsgBox2').niceScroll({cursorcolor: "#FFF", cursorwidth: "2px", cursorborder: "0px;"});
    $('#OnLineUser_FindList').niceScroll({cursorcolor: "#FFF", cursorwidth: "2px", cursorborder: "0px;"});
    $('#OnLineUser_OhterList').niceScroll({cursorcolor: "#FFF", cursorwidth: "2px", cursorborder: "0px;"});
    $('#OnLineUser').niceScroll({cursorcolor: "#FFF", cursorwidth: "2px", cursorborder: "0px;"});

    //定位div(contenteditable = "true")
    function po_Last_Div(obj) {
        if (window.getSelection) {//ie11 10 9 ff safari
            obj.focus(); //解决ff不获取焦点无法定位问题
            var range = window.getSelection();//创建range
            range.selectAllChildren(obj);//range 选择obj下所有子内容
            range.collapseToEnd();//光标移至最后
        }
        else if (document.selection) {//ie10 9 8 7 6 5
            var range = document.selection.createRange();//创建选择对象
            //var range = document.body.createTextRange();
            range.moveToElementText(obj);//range定位到obj
            range.collapse(false);//光标移至最后
            range.select();
        }
    }

    $("#Msg").keydown(function(e) {
        if (e.keyCode == 13) {
            //ToUser.set($("#ToUser").val(), $("#ToUser").find("option:selected").text());
            //SysSend.msg();
            //HideMenu();
            //MsgCAlert();
            //return false
            if(check_auth('room_admin')){
                e.preventDefault();
                $('#Msg').append('<BR><BR>');
                po_Last_Div(this);
            }else {
                ToUser.set($("#ToUser").val(), $("#ToUser").find("option:selected").text());
                SysSend.msg();
                HideMenu();
                MsgCAlert();
            }


            return false;
        }
    });
    $("#Send_bt").on("click", function() {
        // 判断是否登录
        //if(!is_login){
        //    $('.login_tip').fadeIn(500);
        //    return false;
        //}else{
            ToUser.set($("#ToUser").val(), $("#ToUser").find("option:selected").text());
            HideMenu();
            MsgCAlert();
            var msg_t = $('#Msg').text();

            if($('#Msg').html().length <= 0){
                layer.msg('请写入您要发表的内容！', {shift: 6});
                return false;
            }

            if(msg_t.length>20){
                if (!check_auth("room_admin")){
                    layer.msg('评论最大长度为20！', {shift: 6});
                }else {
                    SysSend.msg();
                }
            }else{
                SysSend.msg();
            }
        //}
    });
    initFaceColobar();

    openWin(1, false, $("#tip_login_win").html(), 800, 350);
    //setTimeout("bt_SwitchListTab('Other')",1000)
}

function firstWin(){
    openWin(1, false, $("#tip_login_win").html(), 800, 350);
}

function OnResize() {

    var cw = $(window).width();
    var ch = $(window).height();
    var vw = cw - 930;
    if (cw >= 1280) {
        if (cw >= 1280)
            vw = cw - 725;
        if (cw >= 1400)
            vw = cw - 800;
        if (cw >= 1600)
            vw = cw - 930;
        if (vw > 520) {
            $('#UI_Central').css("margin-left", 208);//242 + 5原来的尺寸
            $('#UI_Central').css("margin-right", vw + 10);
            $('#UI_Right').css("width", vw);
            $('#OnLine_MV').css("height", ch-325);
        }
		/*var c_w = 242 * 1000 / 378;
		var r_w = cw - (242 + c_w) - 10;
		$('#UI_Right').css("width", r_w);
		$('#OnLine_MV').css("height", r_w / 1000 * 618);
		$('#UI_Central').css("margin-left", 242 + 5);
		$('#UI_Central').css("margin-right", r_w + 10);
		//console.log(c_w);
		//console.log(r_w);*/
    } else {
        $('#UI_Central').css("margin-left", "252px");
        $('#UI_Central').css("margin-right", "530px");
        $('#UI_Right').css("width", 520);
        //$('#OnLine_MV').css("height", 520 / 1000 * 618);

        $('#OnLine_MV').css("height", ch-325);
    }

    var cH = $(window).height() - 13;
    $('#UI_MainBox').height(cH);
    $('#MsgBox1').height($('#MsgBox1').height() + cH - $('#UI_Central').height() - $('#UI_Head').height());

    $('#OnLineUser').height($('#OnLineUser').height() + $('#UI_Central').height() - $('#UI_Left2').height()+90);
    $('#UI_Left1').height($('#UI_Left2').height());
    $('#NoticeList').height($('#NoticeList').height() + $('#UI_Central').height() - $('#UI_Right').height());

    $("#OnLineUser_OhterList").height($('#OnLineUser').height());
    $("#OnLineUser_FindList").height($('#OnLineUser').height());
}
function OnUnload() {
    var str = "Logout=M=";
    socket.emit('message', str);

}
function tCam(tag)
{
    My.cam = tag;
}
function tCamState(tag)
{
    My.camState = tag;
    //alert(tag);
}
function onConnect()
{
    setInterval("online('"+My.rst+"')",10000);
    getId('Msg').innerHTML = "";
    var str = 'Login=M=' + My.roomid + '|' + My.chatid + '|' + My.nick + '|' + My.sex + '|' + My.age + '|' + My.qx + '|' + My.ip + '|' + My.vip + '|' + My.color + '|' + My.cam + '|' + My.state + '|' + My.mood;
    socket.emit('message', str);

    if (typeof (UserList) != 'undefined') {
        UserList.init();
    }
    //bt_fenping();
}


function h_l(e)
{
    if (getId('UI_Left').style.display == '')
    {
        getId('UI_Left').style.display = 'none';
        getId('UI_Central').style.marginLeft = '2px';
        e.src = "images/h_r.gif";
    }
    else
    {
        getId('UI_Left').style.display = '';
        getId('UI_Central').style.marginLeft = '157px';
        e.src = "images/h_l.gif";
    }
    getId('FontBar').style.display = 'none';
}
function h_r(e)
{
    if (getId('UI_Right').style.display == '')
    {
        getId('UI_Right').style.display = 'none';
        getId('UI_Central').style.marginRight = '2px';
        e.src = "images/h_l.gif";
    }
    else
    {
        getId('UI_Right').style.display = '';
        getId('UI_Central').style.marginRight = '248px';
        e.src = "images/h_r.gif";
    }
    getId('FontBar').style.display = 'none';
}
function getXY(obj)
{
    var a = new Array();
    var t = obj.offsetTop;
    var l = obj.offsetLeft;
    var w = obj.offsetWidth;
    var h = obj.offsetHeight;
    while (obj = obj.offsetParent)
    {
        t += obj.offsetTop;
        l += obj.offsetLeft;
    }
    a[0] = t;
    a[1] = l;
    a[2] = w;
    a[3] = h;
    return a;
}


function CloseColorPicker()
{
    getId('ColorTable').style.display = 'none'
}


function ck_Font(e, act)
{
    if (e != null)
    {
        e.value == 'true' ? e.value = 'false' : e.value = 'true';
    }
    switch (act)
    {
        case 'FontBold':
            if (e.value == 'true')
                getId('Msg').style.fontWeight = 'bold';
            else
                getId('Msg').style.fontWeight = '';
            break;
        case "FontItalic":
            if (e.value == 'true')
                getId('Msg').style.fontStyle = 'italic';
            else
                getId('Msg').style.fontStyle = '';
            break;
        case 'Fontunderline':
            if (e.value == 'true')
                getId('Msg').style.textDecoration = 'underline';
            else
                getId('Msg').style.textDecoration = '';
            break;
        case 'FontColor':
            getId('Msg').style.color = getId('ColorShow').style.backgroundColor;
            break;
        case 'ShowColorPicker':
            bt_ColorPicker();
            break;
    }
}
function ColorPicker()
{
    var baseColor = new Array(6);
    baseColor[0] = "00";
    baseColor[1] = "33";
    baseColor[2] = "66";
    baseColor[3] = "99";
    baseColor[4] = "CC";
    baseColor[5] = "FF";
    var myColor;
    myColor = "";
    var myHTML = "";
    myHTML = myHTML + "<div style='WIDTH:180px;HEIGHT:120px;' onclick='ck_Font(null,\"FontColor\");CloseColorPicker()'>";
    for (i = 0; i < 6; i++)
    {
        for (j = 0; j < 3; j++)
        {
            for (k = 0; k < 6; k++)
            {
                myColor = baseColor[j] + baseColor[k] + baseColor[i];
                myHTML = myHTML + "<li data=" + myColor + " onmousemove=\"document.getElementById('ColorShow').style.backgroundColor=this.style.backgroundColor\" style='background-color:#" + myColor + "'></li>";
            }
        }

    }
    for (i = 0; i < 6; i++)
    {
        for (j = 3; j < 6; j++)
        {
            for (k = 0; k < 6; k++)
            {
                myColor = baseColor[j] + baseColor[k] + baseColor[i];//get   Color   
                myHTML = myHTML + "<li data=" + myColor + " onmousemove=\"document.getElementById('ColorShow').style.backgroundColor=this.style.backgroundColor\" style='background-color:#" + myColor + "'></li>";
            }
        }
    }

    myHTML = myHTML + "</div><div style='border:0px; width:180px; height:10px; background:#333333' id='ColorShow'></div>";
    document.getElementById("ColorTable").innerHTML = myHTML;
}
var ColorInit = false;
function bt_ColorPicker()
{
    var t = getXY(getId('FontColor'));
    getId('ColorTable').style.top = t[0] - 145 + 'px';
    getId('ColorTable').style.left = t[1] + 1 + 'px';
    if (!ColorInit)
    {
        ColorPicker();
        ColorInit = true;
    }
    getId('ColorTable').style.display = '';
    getId('ColorTable').focus();
    return true;

}

function bt_Personal(e)
{
    if (e.value == 'false')
    {
        e.value = 'true';
        e.src = "images/Personal_true.gif";
        e.title = '私聊中...[公聊/私聊]';
    }
    else
    {
        e.value = 'false';
        e.src = "images/Personal_false.gif";
        e.title = '公聊中...[公聊/私聊]';
    }
}
function bt_FontBar(e)
{
    if (getId('FontBar').style.display == 'none')
    {
        var t = getXY(getId('UI_Control'));
        getId('FontBar').style.display = '';
        //getId('FontBar').style.top = t[0] - 29 + 'px';
        //getId('FontBar').style.left = isIE ? t[1] + 1 : t[1] + 'px';
        getId('FontBar').style.top = '0px';
        getId('FontBar').style.left = '0px';
        getId('FontBar').style.width = t[2] - 8 + 'px';
    }
    else
    {
        getId('FontBar').style.display = 'none';
    }
}
function bt_Send_key_option(e)
{
    var t = getXY(e);
    getId('Send_key_option').style.top = t[0] - 50 + 'px';
    getId('Send_key_option').style.left = t[1] + 2 - 165 + 'px';
    getId('Send_key_option').style.display = '';
    getId('Send_key_option').focus();
}



function InsertImg(id, src) {
    $(id).append('<img src=\"' + src + '\">');
}
function bt_insertImg(id)
{
    $('#imgUptag').val(id);
    $('#filedata').click();
}
function bt_gifts(e) {
    openWithIframe('送礼物', '../glist_room.php', 300, 405, '', true)
}
function bt_MsgClear() {
    getId('MsgBox1').innerHTML = '';
    getId('MsgBox2').innerHTML = '';
}
function bt_SendEmote(obj) {
    getId('Msg').innerHTML = obj.innerHTML;
    SysSend.msg();
    getId('Emote').style.display = 'none';
}
function bt_SwitchListTab(tag) {

    if (tag == 'User') {
        $("#OnLineUser_OhterList").hide();
        $("#OnLineUser_FindList").hide();
        $("#OnLineUser").show();
        $("#listTab1")[0].className = 'bg_png2';
        $("#listTab2")[0].className = '';
    }
    else if (tag == "Other") {
        $("#OnLineUser_OhterList").show();
        $("#OnLineUser_FindList").hide();
        $("#OnLineUser").hide();
        $("#listTab1")[0].className = '';
        $("#listTab2")[0].className = 'bg_png2';
        UserList.getmylist(My.name);
    }
    return false;
}
function bt_defvideosrc() {
    if (check_auth('def_videosrc')) {
        SysSend.command('setVideoSrc', My.chatid + '_+_' + My.nick);
        $.ajax({type: 'get', url: '../ajax.php?act=setdefvideosrc&vid=' + encodeURIComponent(My.chatid) + '&nick=' + encodeURIComponent(My.nick) + '&rid=' + My.rid});
    }
}
function bt_msgBlock(id) {
    SysSend.command('msgBlock', id);
}
function bt_msgAudit(id, a) {
    SysSend.command('msgAudit', id);
    $(a).hide();
}
function bt_FindUser() {
    getId("OnLineUser_OhterList").style.display = "none";
    var username = getId('finduser').value;
    getId("OnLineUser_FindList").style.display = "none";
    getId("OnLineUser").style.display = "";
    //alert(username);
    if (username == "") {
        getId("OnLineUser_FindList").style.display = "none";

        getId("OnLineUser").style.display = "";
    }
    else {
        getId("OnLineUser_FindList").style.display = "";
        getId("OnLineUser_FindList").innerHTML = "";
        getId("OnLineUser_FindList").style.height = getId("OnLineUser").offsetHeight + 'px';
        getId("OnLineUser").style.display = "none";

        var ulist = UserList.List();
        var li = "";
        for (c in ulist) {
            if (ulist[c].nick.toLowerCase().indexOf(username.toLowerCase()) >= 0) {
                //alert(ulist[c].nick);
                li = getId(ulist[c].chatid);
                var t_li = CreateElm(getId("OnLineUser_FindList"), 'li', false, 'fn' + ulist[c].chatid);
                t_li.innerHTML = li.innerHTML;
                t_li.oncontextmenu = li.oncontextmenu;
                t_li.onclick = li.onclick;
                t_li.ondblclick = li.ondblclick;
            }
        }

        if(!t_li){
            $('#OnLineUser_FindList').html('<li id="fn1" style="width: 100%"><p style="line-height: 32px; text-align: center;width: 100%;margin: 0 auto;">搜索的用户不在线或者不存在</p></li>');
        }
    }
}
var fenping = true;

function bt_fenping() {
    if (fenping == true) {
        fenping = false;
        //getId('btfp').src = 'images/FP_true.gif';
        getId('drag_bar').style.display = "";
        getId('MsgBox2').style.display = "";
        getId('MsgBox2').style.height = 100 + 'px';
        getId('MsgBox1').style.height = getId('MsgBox1').offsetHeight - 100 - getId('drag_bar').offsetHeight + "px";
    } else {
        fenping = true;
        //getId('btfp').src = 'images/FP_false.gif';
        getId('MsgBox1').style.height = getId('MsgBox').offsetHeight + "px";
        getId('drag_bar').style.display = "none";
        getId('MsgBox2').style.display = "none";

    }
    MsgAutoScroll();
}
var audioNotify = true;
function bt_toggleAudio() {
    if (audioNotify == true) {
        audioNotify = false;
        getId('toggleaudio').src = 'images/Sc.gif';
    } else {
        audioNotify = true;
        getId('toggleaudio').src = 'images/So.gif';
    }
}
var toggleScroll = true;
function bt_toggleScroll()
{
    if ($("#bt_gundong").attr("select") == "true") {
        $("#bt_gundong").attr("select", "false");
        toggleScroll = false;
    }
    else {
        $("#bt_gundong").attr("select", "true");
        toggleScroll = true;
    }
}


$(function(){
    window.onresize = function(){
        // 以下部分只是为了响应浏览器的高度变化
        
        //var O_h = $('.NoticeList .slideTxtBox .div01 .banner li').eq(0).children('a').children('img').height();
        //$('#NoticeList .slideTxtBox .bd .banner ul').css('height',O_h);
        //$('#NoticeList .slideTxtBox .bd .banner ul li').css('height',O_h);

        var cw = $(window).width();
        var cH = $(window).height();

        var vw = cw - 930;
        if (cw >= 1280) {
            if (cw >= 1280)
                vw = cw - 725;
            if (cw >= 1400)
                vw = cw - 800;
            if (cw >= 1600)
                vw = cw - 930;
            if (vw > 520) {
                $('#UI_Central').css("margin-left", 242 + 5);
                $('#UI_Central').css("margin-right", vw + 10);
                $('#UI_Right').css("width", vw);
                //$('#OnLine_MV').css("height", vw / 1000 * 618);
                $('#OnLine_MV').css("height", cH-325);
            }
        } else {
            $('#UI_Central').css("margin-left", "252px");
            $('#UI_Central').css("margin-right", "530px");
            $('#UI_Right').css("width", 520);
            //$('#OnLine_MV').css("height", 520 / 1000 * 618);
            $('#OnLine_MV').css("height", cH-325);

        }

        var cH = $(window).height() - 13;
        $('#UI_MainBox').height(cH);
        $('#MsgBox1').height($('#MsgBox1').height() + cH - $('#UI_Central').height() - $('#UI_Head').height());

        $('#OnLineUser').height($('#OnLineUser').height() + $('#UI_Central').height() - $('#UI_Left2').height()+90);
        $('#UI_Left1').height($('#UI_Left2').height());
        $('#NoticeList').height($('#NoticeList').height() + $('#UI_Central').height() - $('#UI_Right').height());

        $("#OnLineUser_OhterList").height($('#OnLineUser').height());
        $("#OnLineUser_FindList").height($('#OnLineUser').height());
    }
})


// 点赞
   
function sendFace(pos) {
    var iconUrl = ""
    if (pos == "0") {
        iconUrl = '<img src="/room/skins/chatimg/geili.gif" class="flower_png" border="0" alt="" height="20px;">';
    }
    if (pos == "1") {
        iconUrl = '<img src="/room/skins/chatimg/flower.png" class="flower_png" border="0" alt="" height="20px;">';
    }
    if (pos == "2") {
        iconUrl = '<img src="/room/skins/chatimg/guzhang.png" class="guzhang_png" border="0" alt="" height="20px;">';
    }
    if (pos == "3") {
        iconUrl = '<img src="/room/skins/chatimg/ding.png" class="ding_png" border="0" alt="" height="20px;">';
    }
    if (pos == "4") {
        iconUrl = '<img src="/room/skins/chatimg/zan_icon.png" class="zan_png" border="0" alt="" height="20px;">';
    }
    // alert(iconUrl)
    $('#Msg').html(iconUrl);
    $('#Send_bt').click();
    // 直接插到消息窗口
    // var M_state = $("#MsgBox1").children().hasClass("msg");
    // if(M_state==true){
    //     // alert(1)
    //     $('#MsgBox1>div:last').after('<div style="clear:both;"></div><div class="msg" id="2ae53f8f"><div class="msg_head"><img src="../face/img.php?t=p1&amp;u=x77D7"></div><div class="msg_content"><div><font class="u" onclick="ToUser.set(&quot;x77D7&quot;,&quot;游客77D7&quot;)">游客77D7</font> <img src="/upload/upfile/day_150530/201505301011416492.png" class="msg_group_ico" title="游客-未知访客"> <font class="date">17:27:27</font></div><div class="layim_chatsay" style="margin:5px 0px;"><font style="font-weight:;font-style:; text-decoration:;color:rgb(0, 0, 0); font-family:; font-size:12pt;">'+iconUrl+'</font><em class="layim_zero"></em></div></div></div>');
    // }if(M_state==false){
    //     $('#MsgBox1').append('<div style="clear:both;"></div><div class="msg" id="2ae53f8f"><div class="msg_head"><img src="../face/img.php?t=p1&amp;u=x77D7"></div><div class="msg_content"><div><font class="u" onclick="ToUser.set(&quot;x77D7&quot;,&quot;游客77D7&quot;)">游客77D7</font> <img src="/upload/upfile/day_150530/201505301011416492.png" class="msg_group_ico" title="游客-未知访客"> <font class="date">17:27:27</font></div><div class="layim_chatsay" style="margin:5px 0px;"><font style="font-weight:;font-style:; text-decoration:;color:rgb(0, 0, 0); font-family:; font-size:12pt;">'+iconUrl+'</font><em class="layim_zero"></em></div></div></div>');
    // }
}

// function phone(){
//     var tel = $('.popup .tc-tel');
//     var pic_code = $('.popup .tchuang .m-box .pic-box #pic-code').val().length;
//     var tel_code = $('.popup .tchuang #id_code').val();
//     var mobile = tel.val().match(/^1[3|4|5|7|8][0-9]\d{8}$/);
//     if(!mobile){
//         alert('手机号码不正确，请重新输入！');
//         tel.val('');
//         tel.focus();
//         return false;
//     }else if(pic_code == 0){
//         alert("请输入图形验证码!");
//         $('.popup .tchuang .m-box .pic-box #pic-code').focus();
//         return false;
//     }else if(pic_code != 4){
//         alert("图形验证码不准确!请重新输入");
//         $('.popup .tchuang .m-box .pic-box #pic-code').focus();
//         return false;
//     }else if(tel_code == ""){
//         alert("请输入手机验证码!");
//         return false;
//     }else{
//         web_join(tel.val());
//     }
// }


// 验证码60S倒计时
// var times = 60;
// function time(o){
//     if(times == 0){
//         o.removeAttribute("disabled");       
//         o.value="免费获取验证码";
//         times = 60;
//         $('.popup .tchuang #btn-code').css({'color':'#994e4d'});
//     }else{
//         o.setAttribute("disabled",true);
//         o.value="重新发送(" + times + ")";
//         times--;
//         setTimeout(function() {
//             time(o)
//         },
//         1000)
//         $('.popup .tchuang #btn-code').css({'color':'#ccc'});
//     }
// }
// document.getElementById(".popup .tchuang #btn-code").onclick=function(){time(this);}




